<?php

require_once('includes/pdoconnect.php');
require_once('includes/dataholderclasses.php');
require_once('includes/biocaseunit.php');
require_once('includes/biocaseload.php');

$collobjects = array(63838,76993,76994,90126,90164,109874,131701,132535,132535,133614,135031,136126,139687,163564,
    163567,164135,166223,171428,171432,171970,172979,172987,172997,187680,188462,188465,188467,188468,188470,218433,
    265855,275724,275897,280820,300353,326517,326518,326519,327104,327105,345401,367700,368370,368371,368372,408501,
    408502,409644,409645,430137,430138,432923,433023,463466,483526,483566,555290,555502,569562,591914,591915,591928,
    591929,591931,631650,652404,680668,680670,688658,688802,692325,710713,710713,713166,713292,713387,714035,717045,
    717047,737666,739137,739389,739826,739828,739829,742983,742999,748472,749753,750259,750260,751666,751667,751871,
    751871,765309,779012,795224,795225,801979,807166,807167,807169,809135,814676,814776,815068,815068,815069,815633,
    815650,815900,815961,815966,815969,815972,815973,816851,816869,816873,816875,816875,816915,816916,816952,816964,
    816965,816972,821887,822261,822375,822383,822460,823060,823098,823219,823239,823274,823275,823276,823278,823279,
    823333,823342,823343,823344,823345,823349,823349,823352,823484,823689,823690,823699,823866,823885,823964,823966,
    823968,823969,823992,824060,824084,824389,824389,824398,824400,824407,824595,824631,824632,824634,825161,825286,
    825383,825384,825385,825501,825579,825696,825708,825853,825859,826387,826770,826771,826772,826773,826774,826775,
    826776,826782,827196,827197,827200,827202,827207,827209,827220,827220,827222,827226,827231,827233,827241,827243,
    827255,827258,827264,827462,827463,827464,827465,827469,827470,827471,827473,827474,827475,827481,827482,827483,
    827487,827488,827489,827490,827491,827492,827493,827494,827495,827496,827497,827498,827499,827500,827501,827502,
    827503,827540,827679,827715,827803,827817,827818,827821,827822,827853,827857,827893,828046,828047,828055,828057,
    828059,828066,828067,828070,828076,828077,828079,828083,828089,828090,828120,828122,828123,828126,828127,828128,
    828130,828135,828136,828137,828210,828211,828212,828213,828214,828215,828216,828217,828218,828219,828220,828221,
    828222,828223,828326,828327,828328,828329,828330,828331,828332,828334,828335,828336,828338,828339,828340,828341,
    828344,828345,828346,828347,828350,828352,828355,828356,828357,828360,828361,828363,828364,828939,828940,828941,
    828945,828946,828947,828948,828949,829032,829155,829160,829161,829418,829504);

$identifications = array();
$select = "SELECT CollectionObjectID
    FROM collectionobject
    WHERE CollectionObjectID IN (" . implode(',', $collobjects) . ")";
$stmt = $db->prepare($select);
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_OBJ)) {
    $update = new BioCASeUnit($db, $row->CollectionObjectID);
    $load = new BioCASeLoad($db, $row->CollectionObjectID);
    $update->updateUnit();
    $update->updateIdentification();
    //$identifications[] = array($update->Identifications);
    $load->load('identification', $update->Identifications);

}

/*$handle = fopen('errors/failedids.csv', 'w');
fputcsv($handle, array_keys((array) $identifications[0][0][0]));
foreach ($identifications as $collobj) {
    foreach ($collobj as $collobjj){
        foreach ($collobjj as $ident)
        print_r($ident);
        fputcsv($handle, array_values((array) $ident));
}}

fclose($handle);*/


?>